Waterloo ACM Programming Contest Fall 2
[and.git] / 568 - Just the facts / 568.cpp
blobd0b4fc997a63a3570b004d61216f594a9a232d08
1 #include <stdio.h>
4 int main(){
5 int f[10001];
6 f[1] = 1;
7 for (int i = 2; i <= 10000; ++i){
8 f[i] = f[i-1]*i;
9 while (f[i]%10 == 0) f[i] /= 10;
10 f[i] %= 100000;
11 //printf("f[%d] es %d\n", i, f[i]);
14 int n;
15 while (scanf("%d", &n) == 1){
16 printf("%5d -> %d\n", n, f[n]%10);
18 return 0;